package com.p2p.auth.controller.api;


import com.p2p.auth.domain.dto.QueryPagingDTO;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * Created by Antinomy on 16/11/21.
 */
public abstract class APIController {

    protected Pageable getPage(QueryPagingDTO pagingDto) {
        Sort sort = new Sort(Sort.Direction.DESC, "id");
        Pageable pageable = new PageRequest(pagingDto.getCurPage(), pagingDto.getPageSize(), sort);
        return pageable;
    }

}
